package org.example.error;

public enum EmBusinessError implements CommonError{
    //通用错误类型00001
    PARAMETER_VALIDATION_ERROR(10001,"参数不合法"),
    UNKNOW_ERROR(10002,"未知错误"),
    USER_NOT_EXIST(20001,"用户不存在"),
    USER_LOGIN_FAIL(20002,"用户手机号或密码不存在"),
    USER_NOT_LOGIN(20003,"用户还未登录"),
    //30000开头为交易信息错误定义
    STOCK_NOT_ENOUGH(30001,"库存不足"),
    ORDER_GENERATE_FAIL(30002,"订单号生成失败" ),
    ORDER_CREATE_FAIL(30003,"用户操作过于频繁" ),
    POST_NOT_EXIST(40001,"帖子不存在"),
    POSTID_NOT_EXIST(40002,"帖子id不存在"),
    SYSTEM_ERROR(50001,"系统繁忙"),
    POST_NOT_EXISTING(50002,"暂无帖子"),
    COMMENT_NOT_EXIST(50003,"暂无评论"),
    SORT_ERROR(50004,"排序参数错误"),
    SORT_DIRECTION_ERROR(50005,"排序方向错误"),
    RATE_LIMIT_EXCEEDED(5006,"当前下单人数过多，请稍后重试");
    ;
    private EmBusinessError(int errCode,String errMsg){
        this.errCode=errCode;
        this.errMsg=errMsg;
    }
private int errCode;
private String errMsg;
    @Override
    public int getErrcode() {
        return this.errCode;
    }

    @Override
    public String getErrMsg() {
        return this.errMsg;
    }

    @Override
    public CommonError setErrMsg(String errMsg) {
        this.errMsg=errMsg;
        return this;
    }
}
